/*---------------------------------------------------------------------------------

	by GugloPWN

---------------------------------------------------------------------------------*/

#ifndef MAP_H
#define MAP_H

//#include "player.h"
#include "block.h"

class map {

	public:
	
	

	map() {getdefaultmap();}
	map(char path[64]) {readmap(path);}
	
	void readmap(char path[64]);
	void getdefaultmap();
	void loadmapmodels();
	
	void drawmap(int mx, int my);
	void drawmapcolmap(int mx, int my);
	
	void drawmapblockdeco(int mx, int my);
	
	inline void writemapblock(int mapx, int mapy, char path[64]) {blks[mapx][mapy]->writeblock(path);}
	
	//Pass through setters and getters for the blocks
	inline int getblockbase(int mapx, int mapy,int i, int j) {return blks[mapx][mapy]->getbase(i,j);}
	inline void setblockbase(int mapx, int mapy,int i, int j, int z) {blks[mapx][mapy]->setbase(i,j,z);}
	
	inline int getblockplat(int mapx, int mapy,int i, int j) {return blks[mapx][mapy]->getplat(i,j);}
	inline void setblockplat(int mapx, int mapy,int i, int j, int z) {blks[mapx][mapy]->setplat(i,j,z);}
	
	inline rail getblockrail(int mapx, int mapy,int i) {return blks[mapx][mapy]->getrail(i);}
	inline void setblockrail(int mapx, int mapy,int i, rail newrail) {blks[mapx][mapy]->setrail(i,newrail);}
	
	inline tag getblocktag(int mapx, int mapy,int i) {return blks[mapx][mapy]->gettag(i);}
	inline void setblocktag(int mapx, int mapy,int i, tag newtag) {blks[mapx][mapy]->settag(i,newtag);}
	
	inline deco getblockdeco(int mapx, int mapy,int i) {return blks[mapx][mapy]->getdeco(i);}
	inline void setblockdeco(int mapx, int mapy,int i, deco newdeco) {blks[mapx][mapy]->setdeco(i,newdeco);}
	
	inline pole getblockpole(int mapx, int mapy,int i) {return blks[mapx][mapy]->getpole(i);}
	inline void setblockpole(int mapx, int mapy,int i, pole newpole) {blks[mapx][mapy]->setpole(i,newpole);}
	
	inline item getblockitem(int mapx, int mapy,int i) {return blks[mapx][mapy]->getitem(i);}
	inline void setblockitem(int mapx, int mapy,int i, item newitem) {blks[mapx][mapy]->setitem(i,newitem);}
	
	//inline void setplayer(player* plyr) {p1 = plyr;}
	
	private:
	
	//player *p1;
	block *blks[16][16];
	
	int time;
	//int num_tagspots;
	
	
	
	
		//MD2 stuff
	
	int TexBlk[1];
	int TexBlkPal[1];
	int TexBlkSize;
	int TexDeco[1];
	int TexDecoPal[1];
	int TexDecoSize;
	
	MD2Entity Deco_Model[16];
	bool Deco_ModelEnable[16];
	
	

};

#endif
